<!--
 * @Author: your name
 * @Date: 2020-06-29 17:42:58
 * @LastEditTime: 2020-07-07 16:04:43
 * @LastEditors: Please set LastEditors
 * @Description: 图文详情
 * @FilePath: \JKShopping\jkshopping\src\pages\home\components\goodsDetails\components\goodsDesc.vue
--> 
<template>
  <div class="goodsDesc">
    <h1>继续下滑查看图文详情</h1>
    <div class="img" v-html="goods_desc" :class="show === false ? 'ifshow' : ''"></div>
  </div>
</template>

<script>
export default {
  props: {
    goods_desc: {
      type: String,
      required: true
    }
  },
  data() {
    return {
      show: false,
      loading: false,
      finished: false
    };
  },
  activated() {
    this.show = false
    let that=this
    window.onscroll = function() {
      // scrollTop 滚动条滚动时，距离顶部的距离
      var scrollTop =
        document.documentElement.scrollTop || document.body.scrollTop;
      // windowHeight 可视区的高度
      var windowHeight =
        document.documentElement.clientHeight || document.body.clientHeight;
      // scrollHeight 滚动条的总高度
      var scrollHeight =
        document.documentElement.scrollHeight || document.body.scrollHeight;
      // 滚动条到底部的条件
      if (scrollTop + windowHeight == scrollHeight) {
        // 加载数据
        // that.onLoad();
        that.show = true
      }
    };
  }
};
</script>

<style lang="scss" scoped>
@import "@/style/home/goodsDesc.scss";
</style>